package cn.wolfcode.crm.serivce.impl;

import cn.wolfcode.crm.domain.Department;
import cn.wolfcode.crm.domain.SystemLog;
import cn.wolfcode.crm.mapper.SystemLogMapper;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.serivce.ISystemLogService;
import cn.wolfcode.crm.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;


@Service
public class SystemLogServiceImpl implements ISystemLogService {
    @Autowired
    private SystemLogMapper mapper;

    @Override
    public void deleteByPrimaryKey(Long id) {
        mapper.deleteByPrimaryKey(id);
    }


    @Override
    public void saveOrUpdate(SystemLog record) {
        if (record.getId() == null) {
            //保存操作
            mapper.insert(record);
        }else {
            mapper.updateByPrimaryKey(record);
        }
    }

    @Override
    public SystemLog selectByPrimaryKey(Long id) {
        return mapper.selectByPrimaryKey(id);
    }

    @Override
    public PageResult query(QueryObject qo) {

//        Integer total = mapper.count(qo);
//        if (total > 0) {
//            List<SystemLog> rows = mapper.query(qo);
//
//            return new PageResult(total,rows);
//        }
//        return new PageResult(0, Collections.EMPTY_LIST);
        return null;
    }

    @Override
    public List<SystemLog> selectAll() {
        return mapper.selectAll();
    }

    @Override
    public void deleteAll() {
        mapper.deleteAll();
    }
}
